package lumis.portal;

import java.util.*;

import lumis.util.IResource;

/**
 * String resource for the portal
 *
 * @version $Revision: 6239 $ $Date: 2007-03-26 15:50:32 -0300 (Mon, 26 Mar 2007) $
 * @since 4.0.0
 */
public class PortalStringResource implements IResource
{
	private static final String resourcePath = "lumis/portal/strings/strings";
	private static final String adminResourcePath = "lumis/portal/strings/adminstrings";
	protected Vector<String> resourcePaths = new Vector<String>();
	
	public PortalStringResource()
	{
		addResourcePath(PortalStringResource.resourcePath);
		addResourcePath(PortalStringResource.adminResourcePath);
	}

	public Enumeration<String> getResourcePaths()
	{
		return resourcePaths.elements();
	}

	public void addResourcePath(String resourcePath)
	{
		if (resourcePath != null)
			resourcePaths.add(0, resourcePath); // stack the new resourcePath
	}
	
	public void addAllResourcePaths(IResource resource)
	{
		Enumeration<String> resourcePaths = resource.getResourcePaths();
		
		ArrayList<String> newResourcePaths = new ArrayList<String>();
		while(resourcePaths.hasMoreElements())
			newResourcePaths.add(0, resourcePaths.nextElement());
		
		for (String resourcePath : newResourcePaths)
			addResourcePath(resourcePath);
	}

}
